package sctu.edu.java.year2016.team05.xionglianjin.day20160605.Chapter10_2;

import java.util.*;

/**
 * Created by lianjin on 2016/6/5.
 * 分别向set集合以及list集合中添加“A”，“a”,"c","C","a"5个元素，观察重复值"a"
 * 能否在List集合以及Set集合中成功添加
 */
public class List0 {
    public static void main(String[] args) {
        List<String> list =new ArrayList<>();
        System.out.println("list:");
        list.add("A") ;
        list.add("a") ;
        list.add("c") ;
        list.add("C") ;
        list.add("a") ;
        Iterator<String> mm=list.iterator();
        while(mm.hasNext()){
            System.out.print(mm.next() + "\t");
        }
        System.out.println();
        Set<String> xx=new HashSet<>();
        System.out.println("set:");
        xx.add("A");
        xx.add("a");
        xx.add("c");
        xx.add("C");
        xx.add("a");
        Iterator<String> xf=xx.iterator();
        while(xf.hasNext()){
            System.out.print(xf.next() + "\t");
        }
    }
}
